﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MaterPage/Site.Master" AutoEventWireup="true" CodeBehind="Array-test.aspx.cs" Inherits="Js_Study.Pages.Array.Array_test" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../../Resource/JavaScript-Common/Array_property.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <input type="button" id="btn_1" value="数组清空" />
    <input type="button" id="btn_2" value="添加一项到数组" />
    <input type="button" id="btn_3" value="删除一项" />
    <input type="button" id="btn_4" value="toString" />
    <input type="button" id="btn_5" value="Exist" />
    <input type="button" id="btn_6" value="Find By Index" />
    <input type="button" id="btn_7" value="去除重复项" />
    <input type="button" id="btn_8" value="数组反转" />
    <input type="button" id="btn_9" value="数组正序" />
    <input type="button" id="btn_10" value="数组倒序" />
    <input type="button" id="btn_11" value="数组随机排序" />
    <input type="button" id="btn_12" value="在索引的位置加入元素" />


    <script type="text/javascript">
        var arr = ["a", "b", "c", "d", "e"];

        $("#btn_1").click(function () {
            var temp = arr.clear();
            alert(temp.length);
        })

        $("#btn_2").click(function () {
            var temp = arr.addItem({ name: "1", age: 2 });
            alert(temp[5].name);
        })

        $("#btn_3").click(function () {
            var temp = arr.deleteItem(3);
            alert(temp.toString());
        })

        $("#btn_4").click(function () {
            var temp = arr.toString();
            alert(temp);
        })

        $("#btn_5").click(function () {
            var temp = arr.isExist("aa");
            alert(temp);
        })

        $("#btn_6").click(function () {
            var temp = arr.findItem("c");
            alert(temp);
        })

        $("#btn_7").click(function () {
            var temp = ["a", "b", "a", "b", "c"];
            alert(temp.distinct().arrToString());
        })

        $("#btn_8").click(function () {
            alert(arr.reversed().toString());
        })

        $("#btn_9").click(function () {
            var array = [2, 4, 3, 5, 1, 6, 9, 0, 8];
            alert(array.ascArray().toString());
        })

        $("#btn_10").click(function () {
            var array = [2, 4, 3, 5, 1, 6, 9, 0, 8];
            alert(array.descArray().toString());
        })

        $("#btn_11").click(function () {
            var array = [2, 4, 3, 5, 1, 6, 9, 0, 8];
            alert(array.randomSort().toString());
        })

        $("#btn_12").click(function () {
            var arr1 = ["a", "b", "c"];
            alert("添加之前的数组元素为:" + arr1.toString());

            arr1[5] = "x";
            alert("在索引为5的位置添加元素后，数组为：" + arr1.toString() + "其中填充的元素为:" + arr1[4]);
        })

        //function a() { }

        //alert(typeof a);


    </script>
</asp:Content>
